
doctor_info = []

function initialize(){
	function on_doctor_data(receved_data){
		total_info = JSON.parse(receved_data)
		doctor_info = total_info[0]
		start_page()
	}

	initialize_ajax("/get_doctor_data", on_doctor_data)
}

function start_page(){

	content = '<div id=content_id class=content>'
	content += '<div id=inner_content_id class=inner_content>'


	content += add_single_location(waterlily_place())
	//content += add_location(waterlily_place())
	//content += add_location(harvard_info())
	//content += add_location(spa_info())

	content += '</div></div>'
	document.getElementById('web_content').innerHTML = content
}

function go_to_water(){
	window.location = '/on_calendar'
}

function add_single_location(location_info){
	content = '<img src="' + location_info['logo_img'] + '" '
	content += 'style="width:' + location_info['logo_img_width'] + 'px;height:' 
	content += location_info['logo_img_height'] + 'px;float:left;" >'
	content += '<span style="font-size:24px;font-weight:bold;margin-left:30px;">' + location_info['title'] + '</span>'

	content += 		'<img src="' + location_info['img_2'] + '" '
	content += 		'style="width:' + location_info['img_width'] + 'px;height:' + location_info['img_height'] + 'px;'
	content += 		'border-radius: 7px; -moz-border-radius: 7px; -webkit-border-radius: 7px;margin-top:20px;'
	content +=		'box-shadow: 5px 5px 5px #444444;float:right;" '
	content +=		'alt="acupuncture image here"><br>'
	content += 		'<br><br>'

	content += '<span style="font-size:15px; font-family: \'Oxygen\', sans-serif; color: #6a6a6a;">'
	content += '<a href="' + location_info['website'] + '">'
	//content += location_info['Website_title']
	//content += pretty_button('go_to_water()', 'Schedule Online', 150, 40, '')
	content += '</a><br>'

	content += "<span style='color:#e7ae24;font-size:16px;font-weight:bold;'> Call today for an appointment : </span><br>"
	content += location_info['phone']

	content += "<span style='color:#e7ae24;font-size:16px;font-weight:bold;'> Hours : </span><br>"
	content += location_info['schedule'] + '<br><br>'

	content += "<span style='color:#e7ae24;font-size:16px;font-weight:bold;'> Location : </span><br>"
	content += '<a href="' + location_info['map_link']	 + '">'
	content += location_info['address'] + '<br>'
	content += '</a>'
	//content += location_info['phone'] 

	if(location_info['form_text'] != ''){
		content += '<a href="' + location_info['form'] + '">' + location_info['form_text'] + '</a>'
	}

	content += "<br><br><br>"
	content += "<span style='color:#e7ae24;font-size:16px;font-weight:bold;'> The treatment room : </span><br><br>"
	content += '<iframe width="800" height="460" src="//www.youtube.com/embed/ET4EbDVSeNg" frameborder="0" allowfullscreen></iframe>'
	content += '</span><br><br>'
	return content

}

function add_location(location_info){
	content = '<div class=inner_card>'
	content += '<div class=inner_card_content>'
	content += '<img src="' + location_info['logo_img'] + '" '
	content += 'style="width:' + location_info['logo_img_width'] + 'px;height:' 
	content += location_info['logo_img_height'] + 'px;float:left;" >'
	content += '<span style="font-weight:bold;margin-left:80px;">' + location_info['title'] + '</span>'

	content += 		'<img src="' + location_info['img'] + '" '
	content += 		'style="width:' + location_info['img_width'] + 'px;height:' + location_info['img_height'] + 'px;'
	content += 		'border-radius: 7px; -moz-border-radius: 7px; -webkit-border-radius: 7px;margin-top:20px;'
	content +=		'box-shadow: 5px 5px 5px #444444;float:right;" '
	content +=		'alt="acupuncture image here"><br>'
	content += 		'<br><br>'
	content += '<span style="font-size:15px; font-family: \'Oxygen\', sans-serif; color: #6a6a6a;">'
	content += '<a href="' + location_info['website'] + '">'
	content += location_info['Website_title']
	content += '</a><br>'
	content += location_info['schedule'] + '<br><br>'

	content += '<a href="' + location_info['map_link']	 + '">'
	content += location_info['address'] + '<br>'
	content += '</a>'
	content += location_info['phone'] 

	if(location_info['form_text'] != ''){
		content += '<a href="' + location_info['form'] + '">' + location_info['form_text'] + '</a>'
	}

	content += '</span>'
	content += '</div></div>'

	return content
}


function harvard_info(){
	location_info = {}
	location_info['logo_img']="/img/harvard_logo.jpg"
	location_info['logo_img_width']=40
	location_info['logo_img_height']=50
	location_info['title']='Harvard Square Chiropractic'
	location_info['img']="/img/harvard_room.jpg"
	location_info['img_width']=190
	location_info['img_height']=200
	location_info['website']="http://harvardsquarechiropractic.com/"
	location_info['address'] = '15 Story Street, Cambridge MA'
	location_info['phone'] = '(617) 441-0101<br><br>'
	location_info['schedule'] = 'Tuesday 12:00pm-8:00pm<br>'
	location_info['schedule'] += 'Thursday 12:00pm-8:00pm'
	location_info['Website_title']='Go To Website'
	location_info['map_link'] = 'https://www.google.com/maps/preview/place/15+Story+St,+Cambridge,+MA+02138/@42.373904,-71.123075,17z/data=!3m1!4b1!4m2!3m1!1s0x89e377686908ca1f:0xaff02fd63f7556d'
	location_info['form'] = ''
	location_info['form_text'] = ''
	return location_info
}

function spa_info(){
	location_info = {}
	location_info['logo_img']="/img/exhale_logo.png"
	location_info['logo_img_width']=130
	location_info['logo_img_height']=30
	location_info['title']='Exhale Spa'
	location_info['img']="/img/exhale_waiting_room.jpg"
	location_info['img_width']=300
	location_info['img_height']=200
	location_info['Website_title']='Go To Website'

	location_info['website']="http://www.exhalespa.com/locations/battery-wharf/"
	location_info['address'] = '2 Battery Wharf Boston, MA 02109'
	location_info['phone'] = '(617) 603-3100<br><br><br>'
	location_info['schedule'] = 'Friday 3:00-9:00<br>Sunday 9:00-2:00<br><br>'
	location_info['map_link'] = ''
	location_info['form'] = ''
	return location_info
}

function schedule_info(){
	d = doctor_info
	schedule = ''
	if(doctor_info['monday_start'] != 'closed')	{ schedule += 'Monday ' + d['monday_start'] + '-' + d['monday_end'] + '<br>'}
	if(doctor_info['tuesday_start'] != 'closed'){ schedule += 'Tuesday ' + d['tuesday_start'] + '-' + d['tuesday_end'] + '<br>'}
	if(doctor_info['wednesday_start'] != 'closed'){ schedule+='Wednesday '+ d['wednesday_start'] + '-' + d['wednesday_end'] + '<br>'}
	if(doctor_info['thursday_start'] != 'closed'){ schedule += 'Thursday ' + d['thursday_start'] + '-' + d['thursday_end'] + '<br>'}
	if(doctor_info['friday_start'] != 'closed')	{ schedule += 'Friday ' + d['friday_start'] + '-' + d['friday_end'] + '<br>'}
	if(doctor_info['saturday_start'] != 'closed'){ schedule += 'Saturday ' + d['saturday_start'] + '-' + d['saturday_end'] + '<br>'}
	if(doctor_info['sunday_start'] != 'closed')	{ schedule += 'Sunday ' + d['sunday_start'] + '-' + d['sunday_end'] + '<br>'}
	return schedule
}
function waterlily_place(){

	location_info = {}
	location_info['logo_img']="/img/waterlily_icon_short.png"
	location_info['logo_img_width']=90
	location_info['logo_img_height']=50
	location_info['title']='Waterlily Wellness'
	location_info['img']="/img/water_room.jpg"
	location_info['img_2']="/img/market_front.jpg"
	location_info['img_width']=400
	location_info['img_height']=250
	location_info['Website_title']='Schedule Online'

	location_info['website']="/on_calendar"
	location_info['address'] = '214 Market St, Brighton MA 02135'
	location_info['phone'] = '(617) 902-8769<br><br><br>'
	location_info['schedule'] = schedule_info()

	location_info['map_link'] = 'https://www.google.com/maps/preview/place/214+Market+St,+Brighton,+MA+02135/@42.355171,-71.1493969,17z/data=!3m1!4b1!4m2!3m1!1s0x89e37833c76b25cb:0xdef3404037dbdfb9'
	//location_info['form_text'] = 'Download Health History Form'
	location_info['form_text'] = ''
	location_info['form'] = 'raw_materials/Acupuncture_Intake.pdf'

	return location_info
}
function om_place(){

	location_info = {}
	location_info['logo_img']="/img/OmNamoLogo_Horizontal_small.png"
	location_info['logo_img_width']=130
	location_info['logo_img_height']=40
	location_info['title']='OM Namo'
	location_info['img']="/img/omnamoroom.jpg"
	location_info['img_width']=300
	location_info['img_height']=200
	location_info['Website_title']='Schedule Online'

	location_info['website']="http://www.genbook.com/bookings/slot/reservation/30095350?bookingContactId=776217229&category=733571234"
	location_info['address'] = '21 Belmont Street, Cambridge, MA 02138'
	location_info['phone'] = '(617) 868-0756<br><br><br>'
	location_info['schedule'] = 'Wednesday 3:00-6:30<br><br>'
	return location_info
}
